package com.heima.wemedia.config;

import com.heima.wemedia.interceptor.WmTokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//想让WmTokenInterceptor生效：
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加在interceptor里定义的拦截器
        registry.addInterceptor(new WmTokenInterceptor())
                .addPathPatterns("/**");//需要拦截什么请求(所有请求)
    }
}
